package com.weishuang.monitor.leader.controller;


import com.weishuang.monitor.leader.commons.entity.Result;
import com.weishuang.monitor.leader.commons.utils.ResultUtils;
import com.weishuang.monitor.leader.entity.vo.ServerProcessInfoVo;
import com.weishuang.monitor.leader.service.IServerProcessInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author weishuang
 * @since 2021-04-19
 */
@RestController
@RequestMapping("/leader/serverProcessinfo")
public class ServerProcessInfoController {

    @Autowired
    private IServerProcessInfoService serverProcessInfoService;

    /**
     * 获取服务器的进程列表
     * @param sysId
     * @return
     */
    @GetMapping("list/{sysId}")
    public Result list(@PathVariable String sysId) {
        List<ServerProcessInfoVo> serverProcessInfoVos = serverProcessInfoService.listProcessInfos(sysId);
        return ResultUtils.success(serverProcessInfoVos);
    }
}
